/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BD;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ARMGARCES
 */
@Entity
@Table(name = "inventario_mp")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InventarioMp.findAll", query = "SELECT i FROM InventarioMp i"),
    @NamedQuery(name = "InventarioMp.findByIdInventariomp", query = "SELECT i FROM InventarioMp i WHERE i.idInventariomp = :idInventariomp"),
    @NamedQuery(name = "InventarioMp.findByFecha", query = "SELECT i FROM InventarioMp i WHERE i.fecha = :fecha"),
    @NamedQuery(name = "InventarioMp.findByOperacion", query = "SELECT i FROM InventarioMp i WHERE i.operacion = :operacion"),
    @NamedQuery(name = "InventarioMp.findByUnidad", query = "SELECT i FROM InventarioMp i WHERE i.unidad = :unidad"),
    @NamedQuery(name = "InventarioMp.findByCantidad", query = "SELECT i FROM InventarioMp i WHERE i.cantidad = :cantidad"),
    @NamedQuery(name = "InventarioMp.findByPrecio", query = "SELECT i FROM InventarioMp i WHERE i.precio = :precio"),
    @NamedQuery(name = "InventarioMp.findByTotal", query = "SELECT i FROM InventarioMp i WHERE i.total = :total")})
public class InventarioMp implements Serializable {
    @Basic(optional =     false)
    @Column(name = "fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idInventario_mp")
    private Integer idInventariomp;
    @Basic(optional = false)
    @Column(name = "operacion")
    private int operacion;
    @Basic(optional = false)
    @Column(name = "unidad")
    private char unidad;
    @Basic(optional = false)
    @Column(name = "cantidad")
    private int cantidad;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @Column(name = "precio")
    private BigDecimal precio;
    @Basic(optional = false)
    @Column(name = "total")
    private BigDecimal total;
    @JoinColumn(name = "fk_idMateriaPrima", referencedColumnName = "idMateriaPrima")
    @ManyToOne(optional = false)
    private Materiaprima fkidMateriaPrima;
    @JoinColumn(name = "fk_idFactura_mp", referencedColumnName = "idFactura_mp")
    @ManyToOne
    private FacturaMp fkidFacturamp;
    @JoinColumn(name = "fk_idProveedor", referencedColumnName = "idProveedor")
    @ManyToOne(optional = false)
    private Proveedor fkidProveedor;

    public InventarioMp() {
    }

    public InventarioMp(Integer idInventariomp) {
        this.idInventariomp = idInventariomp;
    }

    public InventarioMp(Integer idInventariomp, Date fecha, int operacion, char unidad, int cantidad, BigDecimal precio, BigDecimal total) {
        this.idInventariomp = idInventariomp;
        this.fecha = fecha;
        this.operacion = operacion;
        this.unidad = unidad;
        this.cantidad = cantidad;
        this.precio = precio;
        this.total = total;
    }

    public Integer getIdInventariomp() {
        return idInventariomp;
    }

    public void setIdInventariomp(Integer idInventariomp) {
        this.idInventariomp = idInventariomp;
    }

    public int getOperacion() {
        return operacion;
    }

    public void setOperacion(int operacion) {
        this.operacion = operacion;
    }

    public char getUnidad() {
        return unidad;
    }

    public void setUnidad(char unidad) {
        this.unidad = unidad;
    }

    public int getCantidad() {
        return cantidad;
    }

    public void setCantidad(int cantidad) {
        this.cantidad = cantidad;
    }

    public BigDecimal getPrecio() {
        return precio;
    }

    public void setPrecio(BigDecimal precio) {
        this.precio = precio;
    }

    public BigDecimal getTotal() {
        return total;
    }

    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    public Materiaprima getFkidMateriaPrima() {
        return fkidMateriaPrima;
    }

    public void setFkidMateriaPrima(Materiaprima fkidMateriaPrima) {
        this.fkidMateriaPrima = fkidMateriaPrima;
    }

    public FacturaMp getFkidFacturamp() {
        return fkidFacturamp;
    }

    public void setFkidFacturamp(FacturaMp fkidFacturamp) {
        this.fkidFacturamp = fkidFacturamp;
    }

    public Proveedor getFkidProveedor() {
        return fkidProveedor;
    }

    public void setFkidProveedor(Proveedor fkidProveedor) {
        this.fkidProveedor = fkidProveedor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idInventariomp != null ? idInventariomp.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InventarioMp)) {
            return false;
        }
        InventarioMp other = (InventarioMp) object;
        if ((this.idInventariomp == null && other.idInventariomp != null) || (this.idInventariomp != null && !this.idInventariomp.equals(other.idInventariomp))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "BD.InventarioMp[ idInventariomp=" + idInventariomp + " ]";
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }
    
}
